package com.itruth.module.look;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itruth.data.entity.Apperception;
import com.itruth.main.R;

public class LookAdapter extends BaseAdapter {
	
	private LayoutInflater inflater;
	
	private List<Apperception> data;
	
	public LookAdapter(Context context, List<Apperception> data) {
		inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.data = data;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		ViewHolder holder = null;
		
		if (null == convertView) {
			convertView = inflater.inflate(R.layout.look_lv_item, null);
			holder = new ViewHolder();
			holder.content = (TextView) convertView
					.findViewById(R.id.item_textview);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		
		holder.content.setText(data.get(position).getContent());
		
		return convertView;
	}
	
	@Override
	public long getItemId(int position) {
		return position;
	}
	
	public Object getItem(int position) {
		
		return data.get(position);
		
	};
	
	public int getCount() {
		return data.size();
	};
	
	class ViewHolder {
		
		private TextView content;
		
	}
	
	
	
}
